package com.lhb.repertory.mapper;

import com.lhb.repertory.model.Flight;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FlightMapper {

    @Insert("insert into flight( airline, flight_number, aircraft_model, place_of_departure, place_of_arrival, departure_time, arrival_time, airport_of_departure, airport_of_arrival, departure_building, arrival_building, date_of_departure, aircraft_size, on_time_delivery, passenger_type, cabin_type, price)" +
            " VALUES(#{airline},#{flightNumber},#{aircraftModel},#{placeOfDeparture},#{placeOfArrival},#{departureTime},#{arrivalTime},#{airportOfDeparture},#{airportOfArrival},#{departureBuilding},#{arrivalBuilding},#{dateOfDeparture},#{aircraftSize},#{onTimeDelivery},#{passengerType},#{cabinType},#{price}) ")
    void InsertFlight(Flight flight);

    @Select("select * from flight where id=#{id}")
    Flight SelectFlight(Long id);

    @Select("select * from flight ")
    List<Flight> SelectFlight2();

    @Select("select * from flight where id>=#{id1} and id<=#{id2}")
    List<Flight> SelectFlight3(@Param("id1") Long id1, @Param("id2") Long id2);
}
